import { request } from 'umi';

export async function login(body: AircasKB.LoginParams, options?: { [key: string]: any }) {
    // const { loginName, password } = body;
    return request<AircasKB.ResponseType<AircasKB.User>>(
        `/aircaskb/sys/user/login`,
        {
            method: 'POST',
            data:body,
            ...(options || {}),
        },
    );
}

export async function outLogin(options?: { [key: string]: any }) {
    return request<AircasKB.ResponseType<any>>('/aircaskb/sys/user/outLogin', {
        method: 'POST',
        ...(options || {}),
    });
}

export async function getFakeCaptcha(
    params: {
        // query
        /** 手机号 */
        phone?: string;
    },
    options?: { [key: string]: any },
) {
    return request<AircasKB.LoginCaptcha>('/login/captcha', {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}
